import request from "@/request/";

export const getList = (current, size, params) => {
  return request({
    url: "/api/trio-system/menu/list",
    method: "get",
    params: {
      ...params,
      current,
      size,
    },
  });
};

export const getLazyList = (parentId, params) => {
  return request({
    url: "/api/trio-system/menu/lazy-list",
    method: "get",
    params: {
      ...params,
      parentId,
    },
  });
};

export const getLazyMenuList = (parentId, params) => {
  return request({
    url: "/api/trio-system/menu/lazy-menu-list",
    method: "get",
    params: {
      ...params,
      parentId,
    },
  });
};

export const getMenuList = (current, size, params) => {
  return request({
    url: "/api/trio-system/menu/menu-list",
    method: "get",
    params: {
      ...params,
      current,
      size,
    },
  });
};

export const getMenuTree = (tenantId) => {
  return request({
    url: "/api/trio-system/menu/tree",
    method: "get",
    params: {
      tenantId,
    },
  });
};

export const remove = (ids) => {
  return request({
    url: "/api/trio-system/menu/remove",
    method: "post",
    params: {
      ids,
    },
  });
};

export const add = (row) => {
  return request({
    url: "/api/trio-system/menu/submit",
    method: "post",
    data: row,
  });
};

export const update = (row) => {
  return request({
    url: "/api/trio-system/menu/submit",
    method: "post",
    data: row,
  });
};

export const getMenu = (id) => {
  return request({
    url: "/api/trio-system/menu/detail",
    method: "get",
    params: {
      id,
    },
  });
};

export const getTopMenu = () =>
  request({
    url: "/api/trio-system/menu/top-menu",
    method: "get",
  });

export const getRoutes = () =>
  request({
    url: "/admin-api/system/auth/get-permission-info",
    method: "get",
  });
